package com.dbappsecurity.jsbridge.webview;

import android.net.http.SslError;
import android.util.Log;
import com.tencent.smtt.export.external.interfaces.SslErrorHandler;
import com.tencent.smtt.export.external.interfaces.WebResourceRequest;
import com.tencent.smtt.export.external.interfaces.WebResourceResponse;
import com.tencent.smtt.sdk.WebView;
import com.tencent.smtt.sdk.WebViewClient;

public class BWebViewClient extends WebViewClient {

  BWebView mWebView;

  public static BWebViewClient getInstance(BWebView webView) {
    return new BWebViewClient(webView);
  }


  public BWebViewClient(BWebView webView) {
    mWebView = webView;
  }

  public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
    super.shouldOverrideUrlLoading(view, request);
    return false;
  }

  public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
    handler.proceed();
  }

  @Override
  public WebResourceResponse shouldInterceptRequest(WebView webView,
      WebResourceRequest webResourceRequest) {
    Log.i("BWebViewClient", "Arirus shouldInterceptRequest: "+webResourceRequest);
    return super.shouldInterceptRequest(webView, webResourceRequest);
  }
}
